import request from './axiosApi'

// 定义接口
// 登录

export const login = date => request.post('/admin/login', date)

// 退出登录
export const signout = () => request.get('/admin/signout')

// 用户注册量
export const userCount = date => request.get('/statis/user/' + date + '/count')

// 订单量
export const orderCount = date => request.get('/statis/order/' + date + '/count')

// 管理员
export const adminCount = date => request.get('/statis/admin/' + date + '/count')

// 某一天新增用户数量
export const allUserCount = date => request.get('/v1/users/count/', date)

// 某一天管理员注册量
export const allAdminCount = () => request.get('/admin/count')

// 某一天订单数量
export const allOrderCount = date => request.get('/bos/orders/count', date)

// 获取用户列表
// export const usersList = data => request.get('/v1/users/list', data)

// 获取定位城市参数
export const cityGuess = () => request.get('/v1/cities?type=guess')

/**
 * 获取餐馆数量
 */
export const getRestaurantCount = () => request.get('/shopping/restaurants/count')

// 获取餐馆列表
// export const getge = () => request.get(`/shopping/restaurants?latitude=${latitude}&longitude=${longitude}`)

// 获取搜索地址
// export const searchplace = (id, cityValue) => request.get('/v1/pois', { type: 'search', city_id: id, keyword: cityValue })
export const foodCategory = (latitude, longitude) => request.get('/shopping/v2/restaurant/category')

/**
 * 更新餐馆信息
 */
export const updateResturant = data => request.post('/shopping/updateshop', data)

/**
 * 删除餐馆
 */

// export const deleteResturant = restaurant_id => fetch('/shopping/restaurant/' + restaurant_id, {}, 'DELETE');
// eslint-disable-next-line camelcase
export const deleteResturant = restaurant_id => request.delete('/shopping/restaurant/' + restaurant_id, {})

/**
 * 获取食品列表
 */

// export const getFoods = data => request.get('/shopping/v2/foods', data)

// 获取食品总数量
export const getFoodsCount = data => request.get('/shopping/v2/foods/count', data)

/**
 * 获取餐馆详细信息
 */
export const getResturantDetail = restaurant => request.get('/shopping/restaurant/' + restaurant)
/**
 * 获取menu详情
 */

export const getMenuById = category => request.get('/shopping/v2/menu/' + category)

/**
 * 获取menu列表
 */

// export const getMenu = data => request.get('/shopping/v2/menu', data)

/**
 * 更新食品信息
 */

export const updateFood = data => request.post('/shopping/v2/updatefood', data)

/**
 * 删除食品
 */

// eslint-disable-next-line camelcase
export const deleteFood = food_id => request.delete('/shopping/v2/food/' + food_id)

/**
 * 获取订单列表
 */

// export const getOrderList = data => request.get('/bos/orders', data)

/**
 * 获取订单数量
 */

export const getOrderCount = data => request.get('/bos/orders/count', data)

/**
 * 获取用户信息
 */

export const getUserInfo = userId => request.get('/v1/user/' + userId)

/**
 * 获取地址信息
 */

export const getAddressById = address => request.get('/v1/addresse/' + address)

/**
 * 管理员列表
 */

// export const adminList = data => request.get('/admin/all', data)

/**
 * 管理员数量
 */

export const adminCountNum = () => request.get('/admin/count')

/**
 * 添加商铺
 */

export const addShop = data => request.post('/shopping/addShop', data)

/**
 * 获取当前店铺食品种类
 */

export const getCategory = restaurantID => request.get('/shopping/getcategory/' + restaurantID)

/**
 * 添加食品种类
 */

export const addCategory = data => request.post('/shopping/addcategory', data)

/**
 * 添加食品
 */

export const addFood = data => request.post('/shopping/addfood', data)

/**
 * 获取用户分布信息
 */

export const getUserCity = () => request.get('/v1/user/city/count')

/**
 * 获取用户信息
 */

export const getAdminInfo = () => request.get('/admin/info')
